//
//  XNDetailViewController.swift
//  weibo
//
//  Created by 王向宁 on 16/5/19.
//  Copyright © 2016年 王向宁. All rights reserved.
//

import UIKit

class XNDetailViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.title = "\(navigationController?.childViewControllers.count ?? 0)"

        view.backgroundColor = UIColor.whiteColor()
        
//        let back = UIBarButtonItem(imageName: "navigationbar_back_withtext", title: "返回", target: self, action: #selector(XNDetailViewController.back))
//        
//        self.navigationItem.leftBarButtonItem = back
        
        //进入多级页面
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "下一页", style: .Plain, target: self, action: #selector(next))
    }
    
    @objc private func next() {
        
        let next = XNDetailViewController()
        navigationController?.pushViewController(next, animated: true)
    }
    
//    @objc private func back() {
//        navigationController?.popViewControllerAnimated(true)
//    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
